<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width,user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="keywords" content="任务管理"/>
    <meta name="description" content="任务管理"/>
    <meta name="author" content="小柒2012"/>
    <meta name="site" content="https://blog.52itstyle.com"/>
    <title>登陆</title>
    <link th:href="@{/flat_ui/css/vendor/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/flat_ui/css/flat-ui.css}" rel="stylesheet"/>
    <script th:src="@{/libs/jquery-3.2.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/libs/vue.min.js}" type="text/javascript"></script>
    <script th:src="@{/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/iview/iview.min.js}" type="text/javascript"></script>
    <script th:src="@{/common.js}" type="text/javascript"></script>
</head>
<body>
<div id="app" v-cloak class="container" style="margin-top: 1%;">
    <div class="row">
        <div class="col-md-10 col-md-offset-1">

            <div class="login">
                <div class="login-screen">
                    <div class="login-icon">
                        <a target="_blank" href="https://blog.52itstyle.com" class="text-warning"><h3>灵伴即时</h3></a>
                        <a target="_blank" href="https://blog.52itstyle.com/"><img
                                th:src="@{/flat_ui/img/qiuchang8_qrcode.jpg}"
                                class="img-rounded img-responsive"/></a>
                    </div>
                    <div class="login-form">
                        <!-- 这是个假的登录 -->
                        <!-- <form  method="post"> -->
                        <div class="control-group">
                            <input type="text" name="username" class="login-field form-control" id="username"
                                   placeholder="请输入用户名"
                                   required="required" maxlength="255" autocomplete="off"/>
                            <label class="login-field-icon fui-user" for="username"></label>
                        </div>
                        <div class="control-group">
                            <input type="password" name="password" class="login-field form-control" id="password"
                                   placeholder="请输入密码"
                                   required="required" maxlength="255"/>
                            <label class="login-field-icon fui-lock" for="password"></label>
                        </div>

                        <button class="btn btn-primary btn-large btn-block" @click="login()">
                            登陆
                        </button>

                        <span class="text-danger pull-right" style="font-size: 13px;margin-top: 15px;">

                            </span>
                        <a class="login-link" target="_blank" href="https://blog.52itstyle.com">&raquo; 注册</a>
                        <!--  </form> -->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">


    var vm = new Vue({
        el: '#app',
        data: {},
        methods: {

            login: function () {
                var userName = $("#username").val();
                var passwd = $("#password").val();

                $.ajax({
                    url: "/login",
                    type: "post",
                    data: {'userName': userName, 'passwd': passwd},
                    success: function (result) {
                        if (result.code == "0") {
                            window.location.href = "main.shtml#task/index.shtml";
                        } else {
                            alert(result.msg);
                        }
                    }
                });
            }
        }
    })

</script>
</body>
</html>